/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */


int kthToLast(struct ListNode *head, int k) {
	struct ListNode *slow = head;
	struct ListNode *fast = head;
	while (k > 0) {
		fast = fast->next;
		k--;
	}

	while (fast != NULL) {
		fast = fast->next;
		slow = slow->next;
	}

	return slow->val;
}
